<template id="temp"> <!-- vue实例外创建 -->
  <div>
    <el-container>
      <el-header>
        <h1>人员管理系统</h1>
        <div>
          <el-dropdown>
            <span class="el-dropdown-link">
              <img class="headimg" src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg"
                alt=""><i class="el-icon-arrow-down el-icon--right"></i>
            </span>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item>个人中心</el-dropdown-item>
              <el-dropdown-item>控制台</el-dropdown-item>
              <el-dropdown-item divided>退出</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </div>
      </el-header>
      <el-container>
        <el-aside width="200px">
          <el-menu
            default-active="2"
            class="el-menu-vertical-demo"
            @open="handleOpen"
            @close="handleClose"
            background-color="#545c64"
            text-color="#fff"
            active-text-color="#ffd04b"
            router
          >
            <el-submenu :index="item.path" v-for="item in menuslist" :key="item.id">
              <template slot="title">
                <i class="el-icon-location"></i>
                <span>{{item.authName}}</span>
              </template>
              <el-menu-item-group v-for="ited in item.children" :key="ited.id">
                <el-menu-item :index="ited.path">{{ited.authName}}</el-menu-item>
              </el-menu-item-group>
            </el-submenu>
            
          </el-menu>
        </el-aside>
        <el-main>
          <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>
<!-- 调用   <mycom></mycom> -->
<script>
import {GetMenus} from '@/api/user';
export default {
  data() {
    return {
      menuslist:[]
    }
  },
  methods: {
    goto2() {
      this.$router.push('goto2')
    },
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },
    // 请求区
    async getdata() {
      let {data} = await GetMenus()
      this.menuslist = data
      
    },
  },
  mounted() {
    this.getdata()
  }
}
</script>
<style scoped>
.headimg {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

h1 {
  color: var(--fzcolor);
}

.el-header {
  background-color: var(--color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.el-aside {
  background-color: var(--color);
  height: 90.6vh;
  overflow: hidden;
}

.el-main {
  background-color: #f3cf0a24;

}

.el-menu {
  overflow: hidden;
  border: 1px solid var(--color);
}
</style>